package com.key.util;

import java.io.File;
import java.io.FileOutputStream;

import android.os.Environment;
import android.os.PowerManager.WakeLock;

public class Contants {
	public static int cflag = -1;
	public static TimeUnion timeUnion = null;
	public static String fileLastName = ".key";
	public static String filePath = "/servot1mp/431355434/asfjkjfd/fdfd34/FJDKA/";
	public static String fileClassPath = "/servot1mp/431355434/asfjkjfd/fdfd34/FJDKA";
	public static com.key.util.Listener listener = new com.key.util.Listener(
			android.os.Environment.getExternalStorageDirectory()
					+ Contants.filePath, Contants.fileLastName);
	public static WakeLock wakeLock;

	public static void writeFileToSD(String s) {
		String sdStatus = Environment.getExternalStorageState();
		if (!sdStatus.equals(Environment.MEDIA_MOUNTED)) {
			return;
		}
		try {
			String fileName = "log.txt";
			File path = new File(Environment.getExternalStorageDirectory()
					+ filePath);
			File file = new File(Environment.getExternalStorageDirectory()
					+ filePath + fileName);
			if (!path.exists()) {
				path.mkdir();
			}
			if (!file.exists()) {
				file.createNewFile();
			}
			FileOutputStream stream = new FileOutputStream(file,true);
			byte[] buf = s.getBytes();
			stream.write(buf);
			stream.close();

		} catch (Exception e) {
			//Contants.writeFileToSD("[1005]" + e.toString());
		}
	}
}
